# -*- coding: utf-8 -*-


from celery.schedules import crontab

# localhost
broker_url = 'redis://:chench@localhost:6379/1'
result_backend = 'redis://:chench@localhost:6379/2'

# container
# broker_url = 'redis://:chench@redis_host:6379/1'
# result_backend = 'redis://:chench@redis_host:6379/2'

# enable_utc = True
timezone = 'Asia/Shanghai'

imports = {
    # 注意要加上包路径
    'celery_project.task',
}

task_serializer = 'json'
result_serializer = 'json'
accept_content = ['json']


# 急切：任务本地执行
task_always_eager = True
# 急切：执行抛出异常
task_eager_propagates = True

broker_connection_retry_on_startup =True

beat_scheduler = 'django_celery_beat.schedulers:DatabaseScheduler'

# 定时任务调度：celery beat
beat_schedule = {
    # "schedule_task": {
    #     "task": 'schedule_task',
    #     "schedule": crontab(minute="*"),
    # },

}
